package com.indipendent.prototypeone.services;

import org.springframework.beans.factory.annotation.Autowired;

import com.independent.prototypeone.dao.GenericDao;
import com.independent.prototypeone.entity.User;
import com.independent.prototypeone.entity.User.UserId;

public class LoginServiceDelegate {

	@Autowired
	public GenericDao<User> userDao;

	/**
	 * Restituisce un utente prendendo come parametri lo username e la password
	 * 
	 * @param user
	 */
	public User getUser(User user) {
		UserId userId = new User.UserId(user.getUsername(), user.getPassword());
		
		
		return userDao.getItemByID(userId);
	}

	public GenericDao<User> getUserDao() {
		return userDao;
	}

	public void setUserDao(GenericDao<User> userDao) {
		this.userDao = userDao;
	}

}
